libxl: trigger attach events for devices attached before xl devd startup
authorMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Fri, 15 Jul 2016 23:47:56 +0000 (01:47 +0200)
committerWei Liu <wei.liu2@citrix.com>
Tue, 19 Jul 2016 13:12:06 +0000 (14:12 +0100)
commit7d9fa19ec43b05e82443f49eee24d78dd1a3565c
treebe9834266f89ca265af8bfe24eb165e8af9cbf5a
parent4a6ddd21d9850eca30776aa8bf308061ff01f8e6
libxl: trigger attach events for devices attached before xl devd startup

When this daemon is started after creating backend device, that device
will not be configured.

Racy situation:
1. driver domain is started
2. frontend domain is started (just after kicking driver domain off)
3. device in frontend domain is connected to the backend (as specified
   in frontend domain configuration)
4. xl devd is started in driver domain

End result is that backend device in driver domain is not configured
(like network interface is not enabled), so the device doesn't work.

Fix this by artifically triggering events for devices already present in
xenstore before xl devd is started. Do this only after xenstore watch is
already registered, and only for devices not already initialized (in
XenbusStateInitWait state).

Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl.c